/*
 * RegistrationHandler.java
 *
 * Created on October 31, 2006, 3:23 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.asaga.tools;
import java.io.*;
import java.net.*;

import javax.servlet.*;
import javax.servlet.http.*;

import java.sql.*;
import java.util.*;
/**
 *
 * @author jeremys
 */
public class CalendarHandler {
    private Event_StubImpl event;
    private Location location;
    /**
     * Creates a new instance of CalendarHandler
     */
    public CalendarHandler() {
    }
    public CalendarHandler(HttpServletRequest request){
        event = new Event_StubImpl();
        location = new Location();
        event.setTitle(request.getParameter("title"));
        event.setStartDate(request.getParameter("startDate"));
        event.setEndDate(request.getParameter("endDate"));
        event.setStartTime(request.getParameter("startTime"));
        event.setWarningMessage("Is this information correct?");
        event.setEndTime(request.getParameter("endTime"));
        location.setAddr1(request.getParameter("addr1"));
        location.setAddr2(request.getParameter("addr2"));
        location.setCity(request.getParameter("city"));
        location.setState(request.getParameter("state"));
        location.setZip(Integer.parseInt(request.getParameter("zip")));
        location.setWebsite(request.getParameter("website"));
        location.setContactName(request.getParameter("contactName"));
        location.setContactEmail(request.getParameter("contactEmail"));
    }
    public Event_StubImpl getEvent(){
        return event;
    }
    
    public Location getLocation(){
        return location;
    }
    
    public void setEvent(Event_StubImpl e){
        event = e;
    }
    
    public void addEvent(){
        int id = event.eventList.size();
        event.setId(id);
        event.setClassId(0);
        event.setLocationId(0);
        event.setCreatorId(1);
        event.setGroupId(0);
        event.addEvent();
    }
    
    public void setLocation(Location l){
        location = l;
    }
    
}
